import {
  getLevelFirstJson,
  getLevelZeroJson,
  getSelectDataMapList,
  getTenantID,
} from '@/utils';
import { RemindManageAPI } from '../common/type';
// import { AnnounceManageAPI } from '../common/type';
/**
 * @description: 搜索list列表配置
 * @return {搜索列表}
 */
const getSearchColumns = (
  loadMdicMap: Record<string, any>,
  switchObj: Record<string, any>,
): RemindManageAPI.IHeaderSearchType => {
  /**
   * @description: 获取字典的提醒类型
   * @return {"notifyTypeArr"}
   */
  let notifyTypeArr = getSelectDataMapList(
    loadMdicMap?.data?.obj?.[`${getTenantID()}1401`],
    'name',
    'id',
  );
  /**
   * @description: 获取字典的工单类型
   * @return {workOrderType}
   */
  let workOrderType = getSelectDataMapList(
    loadMdicMap?.data?.obj?.[`${getTenantID()}1004`],
    'name',
    'id',
  );
  let orgDeptList: any[] = [];
  if (switchObj?.queryType == 0) {
    orgDeptList = getLevelZeroJson();
  } else if (switchObj?.queryType == 1) {
    orgDeptList = getLevelFirstJson();
  }
  return [
    {
      name: 'notifyContent',
      label: '提醒内容',
      placeholder: '提醒内容',
      componentType: 'Input',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'orderType',
      label: '工单类型',
      placeholder: '工单类型',
      componentType: 'Select',
      allowClear: true,
      dataSource: workOrderType,
      md: 4,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'executeState',
      label: '提醒状态',
      placeholder: '提醒状态',
      componentType: 'Select',
      allowClear: true,
      dataSource: [
        {
          value: '0',
          name: '未开启',
        },
        {
          value: '1',
          name: '待执行',
        },
        {
          value: '2',
          name: '执行中',
        },
        {
          value: '3',
          name: '暂停',
        },
        {
          value: '4',
          name: '取消',
        },
        {
          value: '5',
          name: '结束',
        },
      ],
      md: 4,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'notifyType',
      label: '提醒类型',
      placeholder: '提醒类型',
      componentType: 'Select',
      allowClear: true,
      dataSource: notifyTypeArr,
      md: 4,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'notifyStyle',
      label: '提醒方式',
      placeholder: '提醒方式',
      componentType: 'Select',
      allowClear: true,
      dataSource: [
        {
          value: '0',
          name: '单次提醒',
        },
        {
          value: '1',
          name: '多次提醒',
        },
        {
          value: '2',
          name: '复杂提醒',
        },
      ],
      md: 4,
      sm: 24,
      whetherSenior: false,
    },
    {
      name: 'notifyTime',
      placeholder: '查询',
      label: '提醒时间查询',
      componentType: 'RangePicker',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: true,
    },
    {
      name: 'isSynchro',
      placeholder: '同步情况',
      label: '同步情况',
      componentType: 'Select',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: true,
      dataSource: [
        {
          value: '0',
          name: '同步',
        },
        {
          value: '1',
          name: '不同步',
        },
      ],
    },
    {
      name: 'createTime',
      placeholder: '查询',
      label: '创建时间查询',
      componentType: 'RangePicker',
      allowClear: true,
      md: 4,
      sm: 24,
      whetherSenior: true,
    },
    {
      name: 'createrFormName',
      placeholder: '创建',
      label: '创建',
      componentType: 'DeptAndUser',
      dataSource: orgDeptList,
      allowClear: true,
      md: 6,
      sm: 24,
      whetherSenior: true,
      formOrgType: {
        COMP: 'createCompanyID',
        DEPT: 'createDepartmentID',
        POS: 'createPositionID',
        USER: 'createrID',
      }, //获取组织机构表单name, componentType: 'DeptAndUser', 必传
    },
  ];
};

export { getSearchColumns };
